package com.example.consumer.service;
/**
 * Copyright (c) 2018-2022 ThunderSoft
 * All Rights Reserved by Thunder Software Technology Co., Ltd and its affiliates.
 * You may not use, copy, distribute, modify, transmit in any form this file
 * except in compliance with ThunderSoft in writing by applicable law.
 */


import com.example.custom.rpc.proxy.ProxyFactory;
import com.example.rpc.common.service.HelloService;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @author liyuncong
 * @version 1.0
 * @file SayHelloService
 * @brief SayHelloService
 * @details SayHelloService
 * @date 2022-11-02
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2022-11-02               liyuncong          Created
 */
@Service
public class SayHelloService {

    @PostConstruct
    private void setup() {


        new Thread(() -> {
            HelloService helloService = ProxyFactory.getProxy(HelloService.class);
            String result = helloService.sayHello("wangwu");
            System.out.println(result);
        }).start();

//        new Thread(() -> {
//            Invocation invocation = new Invocation(
//                HelloService.class.getName(),
//                "sayHello",
//                new Class[]{String.class},
//                new Object[]{"zhangsan"}
//            );
//
//            HttpClient httpClient = new HttpClient();
//            final String result = httpClient.send("localhost", 8082, invocation);
//            System.out.println(result);
//        }).start();
    }
}
